
#pragma once
#include "math/Node.h"
namespace Apo
{
// 	class SceneManager
// 	{
// 	public:
// 	protected:
// 	private:
// 	};
// 	class Camera
// 	{
// 	public:
// 	protected:
// 	private:
// 	};

	

class   CSceneManagerEditor: public CBaseEditor
{
    friend class CSceneManagerEditorFactory;
public:
	virtual void            GetObjectProperties(NameValuePairList &retList);
	virtual bool			SetupPropertiesWnd();
	virtual void			SetHandle(void *objHandle,bool display);
	virtual bool            IsNodeType() {return true;};
	virtual void            ShowBoundingBox(bool bShow) {};
    virtual bool            HandleCustomFunction(int BIND_ID, String val);

	/// This function is called when user right clicks a property to get that property specific popup menu
	/// returns false if no menu present (Disabled Menu Items has a "D" prefix where Enabled Menu Items have "E" prefix
	virtual bool            GetObjectContextMenu(StringVector &menuitems);
    /// This function is called when user selects a menuitem from ContextMenu
	virtual void            OnObjectContextMenu(int menuresult);
    /// General Purpose Update Function Used By OgitorsRoot Override for Descendants
  //  virtual bool                 PostSceneUpdate(SceneManager *SceneMngr, Camera *Camera, RenderWindow *RenderWindow);
    /// Overridden by Editor Objects to Import Object Dependant Properties
    virtual CBaseEditor         *Restore(NameValuePairList &retList);
    /// Gets the Handle to encapsulated object
    inline virtual void         *GetHandle() {return static_cast<void*>(m_Handle);};
    /// Returns the Factory associated with this object
	static CBaseEditorFactory   *GetFactory();
    /// Returns the Factory associated with this object can be overridden
	virtual CBaseEditorFactory  *GetFactoryDynamic();
	virtual String	     GetConfigFile() {return m_ConfigFile;};
	virtual Vector3	     GetPosition() {return m_Handle->getRootSceneNode()->getPosition();};
	virtual Vector3	     GetScale() {return m_Handle->getRootSceneNode()->getScale();};
	virtual Quaternion     GetOrientation() {return m_Handle->getRootSceneNode()->getOrientation();};
    //virtual AxisAlignedBox GetAABB() {return m_Handle->getRootSceneNode()->_getWorldAABB();};
 
	virtual Node     *GetNode();
	//virtual SceneManager  *GetSceneManager() {return m_Handle;};
	virtual Vector3	     GetAmbient() {ColourValue val = m_Handle->getAmbientLight();return Vector3(val.r,val.g,val.b);};
	bool                         GetSkyBoxActive() {return m_SkyBoxActive;};
	virtual void			     SetConfigFile(int BIND_ID,String val,bool refresh);

	virtual void SetName(int BIND_ID,String val,bool refresh);

	virtual void SetAmbient(int BIND_ID,Vector3 val,bool refresh);
	virtual void SetSkyBoxActive(int BIND_ID,String val,bool refresh);
	virtual void SetSkyBoxMaterial(int BIND_ID,String val,bool refresh);
	virtual void SetSkyBoxDistance(int BIND_ID,String val,bool refresh);

	inline void SetSkyBoxMaterial(String mat) {m_SkyBoxMaterial = mat;};
	inline void SetSkyBoxDistance(float dist) {m_SkyBoxDistance = dist;};
	inline void SetSkyBoxActive(bool active) {m_SkyBoxActive = active;};

protected:
	SceneManager *m_Handle;
	String        m_ConfigFile;
	String        m_SkyBoxMaterial;
	float         m_SkyBoxDistance;
	bool          m_SkyBoxActive;

	CSceneManagerEditor(String typestring = "OctreeSceneManager", EDITORTYPE etype = ETYPE_SCENEMANAGER);
	virtual            ~CSceneManagerEditor() {};
};

class   CSceneManagerEditorFactory: public CBaseEditorFactory
{
public:
  CSceneManagerEditorFactory() {};
  virtual ~CSceneManagerEditorFactory() {};
  virtual CBaseEditor *CreateObject(CBaseEditor **parent, NameValuePairList &params);
  virtual CBaseEditor *RenameObject(CBaseEditor *object, const String &name) {return object;};
};
}



